<?php
	include("includes/connect.php");
	include("includes/function.php");

	$db = new myDBS;

	$sql ="SELECT company_name, cheque_no, p_id, inpNet ".
			"FROM tbl_petition ".
			"WHERE approved_status =  'Approved' ".
			"AND cheque_no IS NOT NULL ";
	//echo $sql;
	$result = $db->runSQL($sql);
	//$rows = $db->fetch_object ( $result );

	require_once('./fpdf/fpdf.php');

	$pdf = new FPDF();
	$pdf->AliasNbPages();
	$pdf->AddPage();
	//$pdf->SetFont('Arial','B',16);

	$pdf->AddFont('THSarabunNew','','THSarabunNew.php');
	$pdf->SetFont('THSarabunNew','',16);
	//for($i=0; $i < 100; $i++){
	//$pdf->Cell(40,10,'Hello World!');
	//$pdf->SetXY(22, 8);
	//$pdf->Write(0, $rows->bank_name);
	//$pdf->Write($i, "Hello World!");
	//}
	
	/*

	while ( $rows = $db->fetch_object ( $result )){
		//$pdf->Cell(0,10,'Printing line number '.$i,0,1);
		$pdf->Cell(0,10,$rows->cheque_no,0,1);
		//$pdf->Write(0, "adsfsad");
	}
	*/

	$pdf->writeHTML("adsfadsf");

	$pdf->Output();

?>